package com.yan.demo.method;

import java.util.Scanner;

public class MethodTest7 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入第一个整数:");
        int num1 = input.nextInt();
        System.out.println("请输入第二个整数:");
        int num2 = input.nextInt();
        System.out.println("请输入第三个整数:");
        int num3 = input.nextInt();
        printSort(num1, num2, num3);
    }

    // 定义一个无返回值有参数的排序打印算法
    public static void printSort(int num1, int num2, int num3) {
        int[] arr = {num1, num2, num3};
        for (int i = 1; i < arr.length; i++) {
            if (arr[0] < arr[i]) {
                int temp = arr[0];
                arr[0] = arr[i];
                arr[i] = temp;
            }
        }
        if (arr[1] < arr[2]) {
            int temp = arr[1];
            arr[1] = arr[2];
            arr[2] = temp;
        }
        System.out.println("从大到小的顺序是:");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
